<?php
$User=$_POST['user']??'';
$Password=$_POST['password']??'';

$dsn = "sqlsrv:Server=localhost;Database=Task";
$db = new PDO($dsn, "sa", "123456");
$sql = "select * from Admin";
$result = $db->query($sql);
$AdminList = $result->fetchAll(PDO::FETCH_ASSOC);

foreach ($AdminList as $key => $value){
    if ($User==$value['AdminAccount'] && $Password==$value['AdminPassword']){
     echo '登录成功，<a href="list.php">进入列表页</a>';
     break;
    }else{
        echo '登录失败,账号或密码错误,<a href="logout.php">返回登录页</a>';
    }
}



